<template>
  <RouterView />
</template>

<script setup lang="ts">
  import {
    changeTheme,
    registLocalStorageListener
  } from '@/utils/themeUtils'
  import { onMounted } from 'vue';
  import { WEB_TITLE } from './globals';
  import { qiankunWindow, QiankunWindow } from 'vite-plugin-qiankun/dist/helper';

  onMounted(() => {
    try {
      const themeData = JSON.parse(localStorage.getItem('theme') as string)
      if (themeData.primary !== '科技') { changeTheme(themeData) }
    } catch (error) {
      console.log(error);
    }
  })

  registLocalStorageListener()

  !qiankunWindow.__POWERED_BY_QIANKUN__ && (document.title = WEB_TITLE)

</script>
